<?php


namespace app\api\validate;


class ThirdLoginValidate extends BaseValidate
{
    protected $rule = [
        'phone' => 'require|length:32',
        'deviceType' => 'in:IOS,ANDROID',
        'channel' => 'require',
        'sign' => 'require|checkSign'
    ];

    protected $message = [
        'sign.checkSign' => 'sign不合法'
    ];

    protected function checkSign($value, $rule='', $data='', $field='')
    {
        $key = config('token.xingyong_sign');
        if(md5($key.$data['phone']) !== $value){
            return false;
        }
        return true;
    }
}